<template>
	<view>
		<adver v-on:gm="adverclose" v-on:gmindexChangebtn="indexChangebtn" :adveradmin="adveradmin" :clock="clock" :startadv="startadv"></adver>
		<!-- <loading v-if="loading">加载中...</loading> -->
		<view class="page" :style="'height:auto;background:' + diypages.page.background">
			<coupontips @tap="closecoupontips" :showcoupontips="showcoupontips"></coupontips>
			<view style="min-height:100%;height:100%;" v-if="diypages">
				<view v-if="diypages.page.type == 2">
					<view v-for="(diyitem, i) in diypages.items" :key="i">
						<tpl_fixedsearch v-if="diyitem.id == 'fixedsearch'" id="tplfixedsearch" :diyitem="diyitem"></tpl_fixedsearch>
						<tpl_banner :result="result" :swiperheight="swiperheight" @getMessage="navigate" v-if="diyitem.id == 'banner'" id="tplbanner" :diyitem="diyitem"></tpl_banner>
						<tpl_search v-if="diyitem.id == 'search'" id="tplsearch" :diyitem="diyitem"></tpl_search>
						<tpl_notice v-if="diyitem.id == 'notice'" id="tplnotice" :diyitem="diyitem"></tpl_notice>
						<tpl_line v-if="diyitem.id == 'line'" id="tplline" :diyitem="diyitem"></tpl_line>
						<tpl_blank v-if="diyitem.id == 'blank'" id="tplblank" :diyitem="diyitem"></tpl_blank>
						<tpl_title @gm="navigate" v-if="diyitem.id == 'title'" id="tpltitle" :diyitem="diyitem"></tpl_title>
						<tpl_menu @getMessage="navigate" v-if="diyitem.id == 'menu'" id="tplmenu" :diyitem="diyitem"></tpl_menu>
						<tpl_menu2 @getMessage="navigate" v-if="diyitem.id == 'menu2'" id="tplmenu2" :diyitem="diyitem"></tpl_menu2>
						<tpl_listmenu @getMessage="navigate" v-if="diyitem.id == 'listmenu'" id="tpllistmenu" :diyitem="diyitem"></tpl_listmenu>
						<tpl_picturew @getMessage="navigate" v-if="diyitem.id == 'picturew'" id="tplpicturew" :diyitem="diyitem"></tpl_picturew>
						<tpl_coupon @getMessage="navigate" v-if="diyitem.id == 'coupon'" id="tplcoupon" :diyitem="diyitem"></tpl_coupon>
						<tpl_goods @gm="selectPicker" v-if="diyitem.id == 'goods'" id="tplgoods" :diyitem="diyitem"></tpl_goods>
						<tpl_richtext v-if="diyitem.id == 'richtext'" id="tplrichtext" :diyitem="diyitem"></tpl_richtext>
						<tpl_video v-if="diyitem.id == 'video'" id="tplvideo" :diyitem="diyitem"></tpl_video>
						<tpl_copyright v-if="diyitem.id == 'copyright'" id="tplcopyright" :diyitem="diyitem"></tpl_copyright>
						<tpl_topmenu v-if="diyitem.id == 'topmenu'" id="tpltopmenu" :diyitem="diyitem"></tpl_topmenu>
						<tpl_tabbar :index="status" v-on:gm="tabwidget" v-on:gmgetstoremore="getstoremore" :diyitemid="i" v-if="diyitem.id == 'tabbar'" id="tpltabbar" :diyitem="diyitem"></tpl_tabbar>
						<tpl_seckillgroup v-if="diyitem.id == 'seckillgroup'" id="tplseckillgroup" :diyitem="diyitem" :min="min" :hour="hour" :sec="sec"></tpl_seckillgroup>
						<tpl_verifygoods v-if="diyitem.id == 'verifygoods'" id="tplverifygoods" :diyitem="diyitem"></tpl_verifygoods>
						<tpl_pictures v-if="diyitem.id == 'pictures'" id="tplpictures" :diyitem="diyitem"></tpl_pictures>
						<tpl_picture v-if="diyitem.id == 'picture'" id="tplpicture" :diyitem="diyitem"></tpl_picture>
						<tpl_icongroup v-if="diyitem.id == 'icongroup'" id="tplicongroup" :diyitem="diyitem"></tpl_icongroup>
						<tpl_audio v-if="diyitem.id == 'audio'" id="tplaudio" :diyitem="diyitem"></tpl_audio>
						<tpl_detail_swipe :interval="interval" :goods="goods" v-if="diyitem.id == 'detail_swipe'" id="tpldetail_swipe" :duration="duration" :showpic="showpic" :circular="circular" :advHeight="advHeight"></tpl_detail_swipe>
						 <tpl_detail_info v-if="diyitem.id == 'detail_info'" id="tpldetail_info" :goods="goods" :diyitem="diyitem" :dispatchpriceObj="dispatchpriceObj" :preselltimeend="preselltimeend" :minprice="minprice" :maxprice="maxprice" :now="now"></tpl_detail_info> 
						<tpl_detail_sale :diyitemid="diyitemid" v-if="diyitem.id == 'detail_sale'" id="tpldetail_sale" :diyitem="diyitem"></tpl_detail_sale>
						<tpl_spec v-if="diyitem.id == 'detail_spec'" id="tpldetail_spec" :diyitem="diyitem"></tpl_spec>
						<tpl_package v-if="diyitem.id == 'detail_package'" id="tpldetail_package" :diyitem="diyitem"></tpl_package>
						<tpl_shop v-if="diyitem.id == 'detail_shop'" id="tpldetail_shop" :diyitem="diyitem"></tpl_shop>
						<tpl_buyshow v-if="diyitem.id == 'detail_buyshow'" id="tpldetail_buyshow" :diyitem="diyitem"></tpl_buyshow>
						<tpl_comment v-if="diyitem.id == 'detail_comment'" id="tpldetail_comment" :diyitem="diyitem"></tpl_comment>
						<tpl_navbar v-if="diyitem.id == 'detail_navbar'" id="tpldetail_navbar" :diyitem="diyitem"></tpl_navbar>
						<tpl_seckill v-if="diyitem.id == 'detail_seckill'" id="tpldetail_seckill" :diyitem="diyitem"></tpl_seckill> 
					</view>
				
				</view>
				<!-- 自定义页面 -->
				<view v-if="diypages.page.type == 20">
					<view v-for="(diyitem, i) in diypages.items" :key="i">
						<tpl_fixedsearch v-if="diyitem.id == 'fixedsearch'" id="tplfixedsearch" :diyitem="diyitem"></tpl_fixedsearch>
						<tpl_banner :result="result" :swiperheight="swiperheight" @getMessage="navigate" v-if="diyitem.id == 'banner'" id="tplbanner" :diyitem="diyitem"></tpl_banner>
						<tpl_search v-if="diyitem.id == 'search'" id="tplsearch" :diyitem="diyitem"></tpl_search>
						<tpl_notice v-if="diyitem.id == 'notice'" id="tplnotice" :diyitem="diyitem"></tpl_notice>
						<tpl_line v-if="diyitem.id == 'line'" id="tplline" :diyitem="diyitem"></tpl_line>
						<tpl_blank v-if="diyitem.id == 'blank'" id="tplblank" :diyitem="diyitem"></tpl_blank>
						<tpl_title @gm="navigate" v-if="diyitem.id == 'title'" id="tpltitle" :diyitem="diyitem"></tpl_title>
						<tpl_menu @getMessage="navigate" v-if="diyitem.id == 'menu'" id="tplmenu" :diyitem="diyitem"></tpl_menu>
						<tpl_menu2 @getMessage="navigate" v-if="diyitem.id == 'menu2'" id="tplmenu2" :diyitem="diyitem"></tpl_menu2>
						<tpl_listmenu @getMessage="navigate" v-if="diyitem.id == 'listmenu'" id="tpllistmenu" :diyitem="diyitem"></tpl_listmenu>
						<tpl_picturew @getMessage="navigate" v-if="diyitem.id == 'picturew'" id="tplpicturew" :diyitem="diyitem"></tpl_picturew>
						<tpl_coupon @getMessage="navigate" v-if="diyitem.id == 'coupon'" id="tplcoupon" :diyitem="diyitem"></tpl_coupon>
						<tpl_goods @gm="selectPicker" v-if="diyitem.id == 'goods'" id="tplgoods" :diyitem="diyitem"></tpl_goods>
						<tpl_richtext v-if="diyitem.id == 'richtext'" id="tplrichtext" :diyitem="diyitem"></tpl_richtext>
						<tpl_video v-if="diyitem.id == 'video'" id="tplvideo" :diyitem="diyitem"></tpl_video>
						<tpl_copyright v-if="diyitem.id == 'copyright'" id="tplcopyright" :diyitem="diyitem"></tpl_copyright>
						<tpl_topmenu v-if="diyitem.id == 'topmenu'" id="tpltopmenu" :diyitem="diyitem"></tpl_topmenu>
						
						<tpl_tabbar v-on:gm="tabwidget" :index="status" :diyitemid="i" v-if="diyitem.id == 'tabbar'" id="tpltabbar" :diyitem="diyitem"></tpl_tabbar>
						<tpl_seckillgroup v-if="diyitem.id == 'seckillgroup'" id="tplseckillgroup" :diyitem="diyitem" :min="min" :hour="hour" :sec="sec"></tpl_seckillgroup>
						<tpl_verifygoods v-if="diyitem.id == 'verifygoods'" id="tplverifygoods" :diyitem="diyitem"></tpl_verifygoods>
						<tpl_pictures v-if="diyitem.id == 'pictures'" id="tplpictures" :diyitem="diyitem"></tpl_pictures>
						<tpl_picture v-if="diyitem.id == 'picture'" id="tplpicture" :diyitem="diyitem"></tpl_picture>
						<tpl_icongroup v-if="diyitem.id == 'icongroup'" id="tplicongroup" :diyitem="diyitem"></tpl_icongroup>
						<tpl_audio v-if="diyitem.id == 'audio'" id="tplaudio" :diyitem="diyitem"></tpl_audio>
						<tpl_detail_swipe :interval="interval" :goods="goods" v-if="diyitem.id == 'detail_swipe'" id="tpldetail_swipe" :duration="duration" :showpic="showpic" :circular="circular" :advHeight="advHeight"></tpl_detail_swipe>
						 <tpl_detail_info v-if="diyitem.id == 'detail_info'" id="tpldetail_info" :goods="goods" :diyitem="diyitem" :dispatchpriceObj="dispatchpriceObj" :preselltimeend="preselltimeend" :minprice="minprice" :maxprice="maxprice" :now="now"></tpl_detail_info> 
						<tpl_detail_sale :diyitemid="diyitemid" v-if="diyitem.id == 'detail_sale'" id="tpldetail_sale" :diyitem="diyitem"></tpl_detail_sale>
						<!-- 组件更新时间2020401 -->
						<tpl_detail_spec v-if="diyitem.id == 'detail_spec'" id="tpldetail_spec" :diyitem="diyitem" :goods="goods"></tpl_detail_spec>
						 <tpl_package v-if="diyitem.id == 'detail_package'" id="tpldetail_package" :diyitem="diyitem" :goods="goods"></tpl_package>
						<tpl_detail_shop v-if="diyitem.id == 'detail_shop'" id="tpldetail_shop" :diyitem="diyitem" :goods="goods"></tpl_detail_shop>
						<tpl_detail_buyshow @gm="favorite" v-if="diyitem.id == 'detail_buyshow'" id="tpldetail_buyshow" :diyitem="diyitem" :goods="goods"></tpl_detail_buyshow>
						<tpl_detail_comment v-if="diyitem.id == 'detail_comment'" id="tpldetail_comment" :diyitem="diyitem" :goods="goods"></tpl_detail_comment> 
						<tpl_navbar v-if="diyitem.id == 'detail_navbar'" id="tpldetail_navbar" :diyitem="diyitem"></tpl_navbar>
						<tpl_seckill v-if="diyitem.id == 'detail_seckill'" id="tpldetail_seckill" :diyitem="diyitem"></tpl_seckill> 
					</view>
				</view>
			</view>
			<view v-else>
				<block v-if="item.visible == 1" v-for="(item, idx) in shop.sorts" :key="idx">
					<!-- <block data-src="adv.wxml" v-if="item.type == 'adv'">
						<view class="index-advs" v-if="item.data.length > 0">
							<swiper
								:autoplay="autoplay"
								:circular="circular"
								class="index-adcs-sqiper"
								:duration="duration"
								:indicatorDots="indicatorDots"
								:interval="interval"
								:style="advsheight ? 'height:' + advsheight + 'px' : ''"
							>
								<swiper-item v-for="(item, idx) in item.data" :key="idx">
									<navigator class="index-advs-navigator" openType="navigate" :url="item.link">
										<image @load="imagesHeight" class="advimg" data-type="advsheight" mode="widthFix" :src="item.thumb"></image>
									</navigator>
								</swiper-item>
							</swiper>
						</view>
					</block>
					<block data-src="search.wxml" v-if="item.type == 'search'">
						<view class="fui-searchbar bar">
							<view class="searchbar" style="background: #f1f1f2; padding: 10px 10px;">
								<navigator class="weui-search-bar__form" hoverClass="none" openType="navigate" url="/pages/goods/index/index?fromsearch=1">
									<view class="search-input">
										<view class="flex-icon-search" style="line-height:40rpx;"><i class="icox icox-search" style="color: #b4b4b4;"></i></view>
										<view class="input search" style="text-align: left; color: #999999; background: none;line-height:56rpx">输入关键字进行搜索</view>
									</view>
								</navigator>
							</view>
						</view>
					</block>
					<block data-src="notice.wxml" v-if="item.type == 'notice'">
						<view class="index-hot" v-if="item.data.length > 0">
							<view class="weui-flex">
								<view class="flex-head-item item-hotdot">
									<image class="hotdot" :src="hotimg"></image>
									<image class="notification" :src="notification"></image>
								</view>
								<view class="weui-flex__item">
									<swiper
										:autoplay="autoplayHot"
										:circular="circularHot"
										class="index-adcs-sqiper index-notification-swiper"
										:duration="durationHot"
										:indicatorDots="indicatorDotsHot"
										:interval="intervalHot"
									>
										<swiper-item v-for="(item, idx) in item.data" :key="idx">
											<navigator class="notification-navigoter" hoverClass="none" openType="navigate" :url="'/pages/shop/notice/detail/detail?id=' + item.id">
												{{ item.title }}
											</navigator>
										</swiper-item>
									</swiper>
								</view>
							</view>
						</view>
					</block>
					<block data-src="banner.wxml" v-if="item.type == 'banner'">
						<view class="index-banner" v-if="item.bannerswipe == 1 && item.data.length > 0">
							<swiper
								:autoplay="autoplay"
								:circular="circular"
								class="index-adcs-sqiper index-banner-sqiper"
								:duration="duration"
								:indicatorDots="indicatorDots"
								:interval="interval"
								:style="bannerheight ? 'height:' + bannerheight + 'px' : 'height:' + swiperheight + 'px'"
							>
								<swiper-item v-for="(item, idx) in item.data" :key="idx">
									<navigator class="index-advs-navigator" openType="navigate" :url="item.link">
										<image @load="imagesHeight" class="advimg" data-type="bannerheight" mode="widthFix" :src="item.thumb"></image>
									</navigator>
								</swiper-item>
							</swiper>
						</view>
						<block v-else>
							<view class="index-adcs-sqiper index-banner-sqiper" v-for="(item, idx) in item.data" :key="idx">
								<navigator class="index-advs-navigator" openType="navigate" :url="item.link">
									<image class="advimg" mode="widthFix" :src="item.thumb"></image>
								</navigator>
							</view>
						</block>
					</block>
					<block data-src="cube.wxml" v-if="item.type == 'cube'">
						<view class="fui-cube" v-if="item.data.length > 0">
							<navigator openType="navigate" :url="item.data[0].url" v-if="item.data.length == 1"><image mode="widthFix" :src="item.data[0].img"></image></navigator>
							<block v-if="item.data.length > 1">
								<view class="fui-cube-left">
									<navigator openType="navigate" :url="item.data[0].url"><image mode="widthFix" :src="item.data[0].img"></image></navigator>
								</view>
								<view class="fui-cube-right">
									<navigator openType="navigate" :url="item.data[1].url" v-if="item.data.length == 2">
										<image mode="widthFix" :src="item.data[1].img"></image>
									</navigator>
									<block v-if="item.data.length > 2">
										<view class="fui-cube-right1">
											<navigator openType="navigate" :url="item.data[1].url"><image mode="widthFix" :src="item.data[1].img"></image></navigator>
										</view>
										<view class="fui-cube-right2">
											<navigator openType="navigate" :url="item.data[2].url" v-if="item.data.length == 3">
												<image mode="widthFix" :src="item.data[2].img"></image>
											</navigator>
											<view class="left" v-if="item.data.length > 3">
												<navigator openType="navigate" :url="item.data[2].url"><image mode="widthFix" :src="item.data[2].img"></image></navigator>
											</view>
											<view class="right" v-if="item.data.length == 4">
												<navigator openType="navigate" :url="item.data[3].url"><image mode="widthFix" :src="item.data[3].img"></image></navigator>
											</view>
										</view>
									</block>
								</view>
							</block>
						</view>
					</block>-->

					<nav-tpl :items="item" v-if="item.type == 'nav'"></nav-tpl>

					<!--<block data-src="recommand.wxml" v-if="item.type == 'recommand'">
						<block v-if="item.data.length > 0">
							<view class="fui-line" style="background: #f4f4f4;">
								<view class="text text-danger">
									<text class="icox icox-likefill"></text>
									为您推荐
								</view>
							</view>
							<view :class="'fui-goods-group ' + (shop.goodsstyle > 0 ? '' : 'block') + ' border'">
								<view class="fui-goods-item" :data-goodsid="item.id" :data-type="item.type" v-for="(item, idx) in item.data" :key="idx">
									<navigator openType="navigate" :url="'/pages/goods/detail/index?id=' + item.id + '&frommyshop=1'">
										<view class="image" :style="'background-image:url(' + item.thumb + ');'">
											<view
												class="salez"
												style="background-image: url('{php echo tomedia($_W['shopset']['shop']['saleout'])}');"
												v-if="item.total <= 0"
											></view>
										</view>
									</navigator>
									<view class="detail">
										<navigator openType="navigate" :url="'/pages/goods/detail/index?id=' + item.id + '&frommyshop=1'">
											<view class="name">
												<text class="fui-tag fui-tag-danger" v-if="item.ispresell == 1">预售</text>
												{{ item.title }}
											</view>
										</navigator>
										<view class="price">
											<text class="text">￥{{ item.minprice }}</text>
										</view>
									</view>
								</view>
							</view>
						</block>
					</block>
				 -->
				</block>

				<view id="recommand" v-if="storeRecommand">
					<view class="fui-line" style="background: #f4f4f4;">
						<view class="text text-danger">
							<text class="icox icox-hotfill"></text>
							店铺推荐
						</view>
					</view>
					<view class="fui-goods-group block border">
						<block data-type="template" data-is="tpl_list" data-attr="item:item" v-for="(item, idx) in storeRecommand" :key="idx">
							<template name="tpl_list">
								<view class="fui-goods-item" :data-goodsid="item.id" :data-type="item.type">
									<navigator
										openType="navigate"
										:url="item.bargain > 0 ? '../../bargain/detail/detail?id=' + item.bargain : '/pages/goods/detail/index?id=' + item.id"
									>
										<view class="image" :style="'background-image:url(' + item.thumb + ');'">
											<view
												class="salez"
												style="background-image: url('{php echo tomedia($_W['shopset']['shop']['saleout'])}');"
												v-if="item.total <= 0"
											></view>
										</view>
									</navigator>
									<view class="detail">
										<navigator
											openType="navigate"
											:url="item.bargain > 0 ? '../../bargain/detail/detail?id=' + item.bargain : '/pages/goods/detail/index?id=' + item.id"
										>
											<view class="name">
												<image class="bargain_label" src="/static/static/images/label.png" v-if="item.bargain > 0"></image>
												<text class="fui-tag fui-tag-danger" v-if="item.ispresell == 1">预售</text>
												{{ item.title }}
											</view>
										</navigator>
										<view class="index_price price">
											<text class="text">¥{{ item.minprice }}</text>
										</view>
									</view>
								</view>
							</template>

							<navigator :url="'../detail/detail?id=' + item.id">
								<view class="fui-list">
									<view class="fui-list-media"><image class="round" :src="item.thumb"></image></view>
									<view class="fui-list-inner">
										<view class="row">
											<view class="row-text">{{ item.title }}</view>
										</view>
										<view class="subtitle">{{ item.createtime }}</view>
									</view>
									<view class="fui-list-angle"><view class="angle"></view></view>
								</view>
							</navigator>
						</block>
					</view>
				</view>
				<view class="fui-loading" v-if="loading">
					<view class="icon"></view>
					<view class="text">正在加载</view>
				</view>
				<view class="fui-loading empty" v-if="storeRecommand.length == total && total > 0"><view class="text">没有更多了</view></view>
				<!-- <block data-src="/pages/common/copyright.wxml">
					<view class="wxParse" :style="'width: 100%;' + (copyright['bgcolor'] ? 'background: ' + copyright['bgcolor'] : '')">
						<jyf-parser :html="article_wxParseData"></jyf-parser>
					</view>
				</block>
			 -->
			</view>
			<!-- <view :class="'fui-toast ' + (FoxUIToast.show ? 'in' : 'out')">
				<view class="text">{{ FoxUIToast.text }}</view>
			</view> -->
			<view @tap="emptyActive" class="nav-mask" :style="active ? 'display:block' : ''"></view>
			<view :class="unpaid ? '' : 'shut'" id="unpaid" :style="unpaidhide ? 'display:none' : ''">
				<view class="unpaid-alert">
					<view class="unpaid-title">您有一个订单待支付</view>
					<view class="unpaid-subtitle">未支付的订单将在不久之后自动关闭，请尽快支付哦！</view>
					<view class="unpaid-content fui-list-group">
						<navigator class="fui-list" openType="navigate" :url="'/pages/goods/detail/index?id=' + item.id" v-for="(item, index) in nopaygoods" :key="index">
							<view class="fui-list-media img-media">
								<view id="btn-pay"><image class :src="item.thumb"></image></view>
							</view>
							<view class="fui-list-inner">
								<view id="btn-pay">
									<view class="subtitle">{{ item.title }}</view>
								</view>
								<view class="price">
									<span class="bigprice text-danger">
										￥
										<span class="marketprice">{{ item.marketprice }}</span>
									</span>
									<span style="float:right;color:#999;font-size:24rpx">x {{ item.totals }}</span>
								</view>
							</view>
						</navigator>
						<view class="fui-list" v-if="nopaygoodstotal > 3">等多件商品</view>
					</view>
					<navigator @tap="unpaidcolse2" class="btn btn-danger disable block" id="btn-pay" openType="navigate" :url="'/pages/order/detail/index?id=' + nopayorder.id">
						立即支付
						<span style="font-size:24upx;margin-left:20rpx">(合计:￥{{ nopayorder.price }})</span>
					</navigator>
					<i @tap="unpaidcolse" class="icox icox-guanbi1" id="unpaid-colse" style="font-size:60rpx;color:#fff;position: absolute;top:105%;left:46%"></i>
				</view>
			</view>
			<button class="suspended-service" openType="contact" sessionFrom="weapp" showMessageCard="true" :style="'background-color:' + customercolor" v-if="customer == 1">
				<text class="icox icox-customerservice"></text>
			</button>
			<view @tap="phone" class="phone" :style="'background-color:' + phonecolor" v-if="phone == 1"><text class="icox icox-dianhua"></text></view>

			<!-- 	 <include src="/pages/common/goods-picker.wxml"></include>
			<include src="/pages/common/city-picker.wxml"></include> -->
		</view>
		 <view class="model" v-if="modelShow">
			<view class="inner">
				<view class="title">用户未授权</view>
				<view class="image"><image :src="imgUrl + 'plugin/app/static/images/wxapp/shouquan.png'"></image></view>
				<view class="subtitle">您需要先开启【用户信息】，才能使用此功能哦~</view>
				<view class="model-btns">
					<view @tap="cancelclick" class="cancel">取消</view>
					<view @tap="confirmclick" class="confirm">去设置</view>
				</view>
			</view>
		</view>
		<view class="shoucoupon" v-if="showcoupon">
			<image
				:src="imgUrl + 'plugin/app/static/images/wxapp/coupon/bg1.png'"
				style="position: absolute; width: 620rpx;height: 820rpx;top: 130rpx;left: 50%;margin-left: -310rpx;"
			></image>
			<view class="inner">
				<view class="title">新人礼包</view>
				<view class="subtitle">数量有限，先到先得哦</view>
				<scroll-view class="coupon-list" scroll-y="true">
					<view class="item" v-for="(item, index) in cpinfos" :key="index">
						<view class="item-cell">
							<view class="item-inner">
								<view class="t">{{ item.couponname }}</view>
								<view class="b">{{ item.enoughtext }}</view>
							</view>
							<view class="item-remark">
								{{ item.t2 }}
								<span style="font-size:30rpx;">{{ item.t1 }}</span>
							</view>
						</view>
						<view class="indate">{{ item.timelimittext }}</view>
					</view>
				</scroll-view>
				<view @tap="closecoupon" class="know">知道了</view>
			</view>
			<view class="closecoupon"><i @tap="closecoupon" class="icox icox-guanbi-copy"></i></view>
		</view>
	 
	</view>
</template>

<script>
var t = getApp().globalData,
	a = t.requirejs('core'),
	e = t.requirejs('wxParse/wxParse'),
	i = t.requirejs('biz/diypage'),
	s = t.requirejs('biz/diyform'),
	n = t.requirejs('biz/goodspicker'),
	o = (t.requirejs('foxui'), t.requirejs('jquery'));


export default {
	data() {
		return {
			imgUrls: [
				'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509963648306&di=1194f5980cccf9e5ad558dfb18e895ab&imgtype=0&src=http%3A%2F%2Fd.hiphotos.baidu.com%2Fzhidao%2Fpic%2Fitem%2F9c16fdfaaf51f3de87bbdad39ceef01f3a29797f.jpg'
			],
			indicatorDotss: !0,
			autoplays: !0,
			intervals: 2e3,
			durations: 500,
			circulars: !0,
			adveradmin: !0,
			current: 0,
			clock: '',
			diypage: 'true',
			route: 'home',
			icons: t.requirejs('icons'),
			shop: {},
			indicatorDots: !0,
			autoplay: !0,
			interval: 5e3,
			duration: 500,
			circular: !0,
			storeRecommand: [],
			total: 1,
			page: 1,
			loaded: !1,
			loading: !0,
			indicatorDotsHot: !1,
			autoplayHot: !0,
			intervalHot: 5e3,
			durationHOt: 1e3,
			circularHot: !0,
			hotimg: '/static/static/images/hotdot.jpg',
			notification: '/static/static/images/notification.png',
			saleout1: '/static/static/images/saleout-1.png',
			saleout2: '/static/static/images/saleout-2.png',
			saleout3: '/static/static/images/saleout-3.png',
			play: '/static/static/images/video_play.png',
			mute: '/static/static/images/icon/mute.png',
			voice: '/static/static/images/icon/voice.png',
			specs: [],
			options: [],
			diyform: {},
			specsTitle: '',
			active: '',
			slider: '',
			tempname: '',
			buyType: '',
			areas: [],
			closeBtn: !1,
			soundpic: !1,
			sound: !0,
			modelShow: !1,
			limits: !0,
			result: {},
			showcoupon: !1,
			showcoupontips: !1,
			topmenu: {},
			topmenuDataType: '',
			tabbarData: {},
			tabbarDataType: '',
			istopmenu: !1,
			seckillinfo: {}, 
			timer: 0,
			lasttime: 0,
			hour: '-',
			min: '-',
			sec: '-',
			show: '',
			imgUrl: '',
			cover: '',
			showvideo: '',
			swiperheight: '',
			unpaid: '',
			screenWidth: '',
			iconheight: '',
			iconwidth: '',
			inputValue: '',
			unpaidhide: '',
			nopaygoods: '',
			nopaygoodstotal: '',
			nopayorder: '',
			cpinfos: '',
			topmenuindex: '',
			diypages: { page: { type: 0 } },
			item: {},
			startadv: {params:{style:''}},
			customer: 1,
			customercolor: '',
			status:0	//tpl_tabbar 参数，必须配置
		};
	},
	onHide:function(){
		console.log("--关闭轮询");
		clearInterval(this.timer)
	},
	onPullDownRefresh: function() {
		var t = this;
		i.get(this, 'home', function(a) {
			t.getDiypage(a), 0 == a.error && uni.stopPullDownRefresh();
		});
	},
	onReachBottom: function() {
		this.loaded || this.storeRecommand.length == this.total || this.getRecommand();
	},
	onLoad: function(e) {
		uni.hideTabBar({}), (e = e || {});
		var i = this;
		i.setData({
			imgUrl: t.globalData.approot
		}),
			a.get('black', {}, function(t) {
				t.isblack &&
					uni.showModal({
						title: '无法访问',
						content: '您在商城的黑名单中，无权访问！',
						success: function(t) {
							t.confirm && i.close(), t.cancel && i.close();
						}
					});
			});
		var s = decodeURIComponent(e.scene);

		if (!e.id && s) {
			var n = a.str2Obj(s);
			(e.id = n.id), n.mid && ((e.mid = n.mid), t.setCache('usermid', n));
		}

		setTimeout(function() {
			i.setData({
				areas: t.getCache('cacheset').areas
			});
		}, 3e3),
			t.url(e);
		// #ifdef APP-PLUS
		uni.getSetting({
			success: function(t) {
				t.authSetting['scope.userInfo']
					? i.diypageGet()
					: a.get('wxAppSetting', {}, function(t) {
							t.sysset.force_auth, i.diypageGet();
					  });
			}
		});
		// #endif
		i.diypageGet();
		i.setData({
			cover: !0,
			showvideo: !1
		});
		
		uni.getSystemInfo({
			success: function(t) {
				var a = t.windowWidth / 1.7;
				i.setData({
					swiperheight: a
				});
			}
		});
		
	},
	onHide: function() {
		this.setData({
			adveradmin: !1,
			unpaid: !1
		});
	},
	onShow: function() {
		var a = this,
			e = uni.getSystemInfoSync(),
			i = t.getCache('sysset');
		a.getShop(), a.getRecommand(), a.get_hasnewcoupon(), a.get_cpinfos();
		// #ifdef APP-PLUS
		uni.getSetting({
			success: function(t) {
				var e = t.authSetting['scope.userInfo'];
				a.setData({
					limits: e
				});
			}
		});
		// #endif

		var s = i.shopname || '商城首页';
		a.pages && '' != a.pages.title && (s = a.diytitle),
			uni.setNavigationBarTitle({
				title: s
			}),
			a.pages &&
				uni.setNavigationBarColor({
					frontColor: a.pages.titlebarcolor,
					backgroundColor: a.pages.titlebarbg
				}),
			a.setData({
				screenWidth: e.windowWidth
			});
	},
	onShareAppMessage: function() {
		var t = null,
			e = null;
		return this.diytitle && ((t = '/pages/index/index'), (e = this.diytitle)), a.onShareAppMessage(t, e);
	},
	methods: {
		getShop: function() {
			var t = this;
			a.get('shop/get_shopindex', {}, function(a) {
				e.wxParse('wxParseData', 'html', a.copyright, t, '5'),
					t.setData({
						shop: a
					});
			});
		},
		getRecommand: function() {
			var t = this;
			'true' != t.diypage &&
				a.get(
					'shop/get_recommand',
					{
						page: t.page
					},
					function(a) {
						var e = {
							loading: !1,
							total: a.total
						};
						t.setData({
							loading: !1,
							total: a.total,
							show: !0
						}),
							a.list || (a.list = []),
							a.list.length > 0 &&
								(t.setData({
									storeRecommand: t.storeRecommand && t.storeRecommand.concat(a.list),
									page: a.page + 1
								}),
								a.list.length < a.pagesize && (e.loaded = !0));
					}
				);
		},
		diypageGet: function() {
			var a = this;
			i.get(this, 'home', function(e) {
				if ((uni.showTabBar({}), a.getDiypage(e), null != a.startadv && '' != a.startadv)) {
					(0 != a.startadv.status && '' != a.startadv) ||
						uni.getSetting({
							success: function(t) {
								t.authSetting['scope.userInfo'] && a.get_nopayorder();
							}
						});

					if ('params' in a.startadv) {
						var i = a.startadv.params;

						if ('default' == i.style) {
							var s = i.autoclose;
							!(function t(e) {
								a.setData({
									clock: s
								}),
									s <= 0
										? a.setData({
												adveradmin: !1
										  })
										: setTimeout(function() {
												(s -= 1), t(e);
										  }, 1e3);
							})(a);
						}

						if (1 == i.showtype) {
							var n = 1e3 * i.showtime * 60,
								o = t.getCache('startadvtime'),
								r = +new Date(),
								d = !0;
							a.setData({
								adveradmin: !0
							}),
								o && r - o < n && (d = !1),
								a.setData({
									adveradmin: d
								}),
								d && t.setCache('startadvtime', r);
						}
					}
					a.startadv.status;
				}
			});
		},
		goodsicon: function(t) {
			this.setData({
				iconheight: t.detail.height,
				iconwidth: t.detail.width
			});
		},
		getDiypage: function(t) {
			var e = this;
			console.log('---getDiypage');
			o.each(t.diypage.items, function(t, i) {
				if ('topmenu' == i.id)
					if (
						(e.setData({
							topmenu: i
						}),
						null == i[0])
					)
						var s = '';
					else {
						s = i[0].linkurl;
						a.get(
							'diypage/getInfo',
							{
								dataurl: s
							},
							function(t) {
								i[0].data = t.goods.list;
							}
						);
					}

				if ('seckillgroup' == i.id) {
					var n = {};
					(n.status = i.data.status), (n.endtime = i.data.endtime), (n.starttime = i.data.starttime),e.initSeckill(n);
				}
			});
		},
		imagesHeight: function(t) {
			var a = t.detail.width,
				e = t.detail.height,
				i = t.currentTarget.dataset.type,
				s = this;
			uni.getSystemInfo({
				success: function(t) {
					(s.result[i] = (t.windowWidth / a) * e)
					console.log(s.result);
						
							s.setData({
								result: s.result
							});
				}
			});
		},
		bindInput: function(t) {
			this.setData({
				inputValue: t.detail.value
			});
		},
		t1: function(t) {
			console.log(i);
			i.fixedsearch(this, t);
		},
		startplay: function(t) {
			var a = t.currentTarget.dataset.cover;
			this.setData({
				cover: a,
				showvideo: !0
			}),
				(this.videoContext = uni.createVideoContext('Video')),
				this.videoContext.play();
		},
		unpaidcolse: function(t) {
			var a = '';
			(a = 'open' == t.currentTarget.dataset.type),
				this.setData({
					unpaid: a
				});
		},
		unpaidcolse2: function(t) {
			this.setData({
				unpaidhide: !0
			});
		},
		get_nopayorder: function() {
			var t = this;
			a.get('shop/get_nopayorder', {}, function(a) {
				1 == a.hasinfo &&
					t.setData({
						nopaygoods: a.goods,
						nopaygoodstotal: a.goodstotal,
						nopayorder: a.order,
						unpaid: !0
					});
			});
		},
		get_hasnewcoupon: function() {
			var t = this;
			a.get('shop/get_hasnewcoupon', {}, function(a) {
				1 == a.hasnewcoupon &&
					t.setData({
						showcoupontips: !0
					});
			});
		},
		get_cpinfos: function() {
			var t = this;
			a.get('shop/get_cpinfos', {}, function(a) {
				1 == a.hascpinfos &&
					t.setData({
						showcoupon: !0,
						cpinfos: a.cpinfos
					});
			});
		},
		adverclose: function() {
			this.setData({
				adveradmin: !1
			}),
				this.get_nopayorder();
		},
		indexChangebtn: function(t) {
			var a = t.currentTarget.dataset.type;
			uni.navigateTo({
				url: a,
				fail: function() {
					uni.switchTab({
						url: a
					});
				}
			});
		},
		// unpaidcolse: function(t) {
		// 	var a = '';
		// 	(a = 'open' == t.currentTarget.dataset.type),
		// 		this.setData({
		// 			unpaid: a
		// 		});
		// },
		// unpaidcolse2: function(t) {
		// 	this.setData({
		// 		unpaidhide: !0
		// 	});
		// },
		selectPicker: function(a) {
			t.checkAuth();
			var e = this;
			uni.getSetting({
				success: function(t) {
					if (t.authSetting['scope.userInfo']) {
						n.selectpicker(a, e, 'goodslist'),
							e.setData({
								cover: '',
								showvideo: !1
							});
					}
				}
			});
		},
		chooseGift: function(t) {
			n.chooseGift(t, this);
		},
		specsTap: function(t) {
			n.specsTap(t, this);
		},
		emptyActive: function() {
			this.setData({
				active: '',
				slider: 'out',
				tempname: '',
				specsTitle: ''
			});
		},
		buyNow: function(t) {
			n.buyNow(t, this);
		},
		getCart: function(t) {
			n.getCart(t, this);
		},
		select: function() {
			n.select(this);
		},
		inputNumber: function(t) {
			n.inputNumber(t, this);
		},
		number: function(t) {
			n.number(t, this);
		},
		onChange: function(t) {
			return s.onChange(this, t);
		},
		DiyFormHandler: function(t) {
			return s.DiyFormHandler(this, t);
		},
		selectArea: function(t) {
			return s.selectArea(this, t);
		},
		bindChange: function(t) {
			return s.bindChange(this, t);
		},
		onCancel: function(t) {
			return s.onCancel(this, t);
		},
		onConfirm: function(t) {
			return s.onConfirm(this, t);
		},
		getIndex: function(t, a) {
			return s.getIndex(t, a);
		},
		changevoice: function() {
			this.sound
				? this.setData({
						sound: !1,
						soundpic: !0
				  })
				: this.setData({
						sound: !0,
						soundpic: !1
				  });
		},
		phone: function() {
			var t = this.phonenumber + '';
			uni.makePhoneCall({
				phoneNumber: t
			});
		},
		cancelclick: function() {
			this.setData({
				modelShow: !1
			});
		},
		confirmclick: function() {
			this.setData({
				modelShow: !1
			}),
				uni.openSetting({
					success: function(t) {}
				});
		},
		navigate: function(t) {
			var a = t.currentTarget.dataset.url,
				e = t.currentTarget.dataset.phone,
				i = t.currentTarget.dataset.appid,
				s = t.currentTarget.dataset.appurl;
			a &&
				uni.navigateTo({
					url: a,
					fail: function() {
						uni.switchTab({
							url: a
						});
					}
				}),
				e &&
					uni.makePhoneCall({
						phoneNumber: e
					}),
				i &&
					uni.navigateToMiniProgram({
						appId: i,
						path: s
					});
		},
		closecoupon: function() {
			this.setData({
				showcoupon: !1
			});
		},
		closecoupontips: function() {
			this.setData({
				showcoupontips: !1
			});
		},
		tabtopmenu: function(t) {
			var e = this,
				i = e.diypages,
				s = (i.items, t.currentTarget.dataset.id, t.currentTarget.dataset.url),
				n = t.currentTarget.dataset.type,
				r = e.topmenu,
				d = t.currentTarget.dataset.index;

			if (
				(e.setData({
					topmenuindex: d
				}),
				'm0' == t.currentTarget.id &&
					'' == s &&
					a.get(
						'diypage',
						{
							type: 'home'
						},
						function(t) {
							var a = t.diypage;
							o.each(a.items, function(t, a) {
								'topmenu' == a.id && (a.status = n);
							}),
								0 == t.error &&
									e.setData({
										diypages: t.diypage
									});
							console.log(t.diypages);
						}
					),
				'' != s && null != s)
			) {
				if (1 == s.indexOf('pages')) {
					var u = s.lastIndexOf('='),
						c = s.substring(u + 1, s.length);
					a.get(
						'diypage',
						{
							id: c
						},
						function(t) {
							if (0 == t.error) {
								var a = [];

								for (var i in t.diypage.items) a.push(t.diypage.items[i]);

								a.unshift(r);
								var s = new Object();

								for (var o in a) (s[o] = a[o]), 'topmenu' == a[o].id && (a[o].status = n);

								(t.diypage.items = s),
									e.setData({
										diypages: t.diypage,
										topmenuDataType: ''
									});
								console.log(t.diypages);
							}
						}
					);
				} else
					a.get(
						'diypage/getInfo',
						{
							dataurl: s
						},
						function(t) {
							e.topmenu;
							a.get(
								'diypage',
								{
									type: 'home'
								},
								function(a) {
									var i = a.diypage;
									o.each(i.items, function(a, e) {
										if ('topmenu' == e.id)
											for (var i in ((e.status = n), e)) i == n && ((e[i].data = t.goods.list), t.goods.list.length <= 8 && (e[i].showmore = !0));
									}),
										0 == a.error &&
											e.setData({
												diypages: a.diypage,
												topmenuDataType: t.type
											});
									console.log(a.diypages);
								}
							);
						}
					);

				e.setData({
					diypages: i
				});
			}
		},
		tabwidget: function(t) {
			
			var e = this,
				i = e.diypages,
				s = (i.items, t.currentTarget.dataset.id),
				n = t.currentTarget.dataset.url,
				o = t.currentTarget.dataset.type;
			'' != n &&
				null != n &&
				a.get(
					'diypage/getInfo',
					{
						dataurl: n
					},
					function(t) {
						for (var a in i.items){
							if (a == s) {
								
								(i.items[a].data[o].data = t.goods.list),
									(i.items[a].data[o].type = t.type),
									(i.items[a].type = t.type),
									(i.items[a].status = (o-0)),
									t.goods.list.length <= 8 && (i.items[a].data[o].showmore = !0);
								e.setData({
									diypages: i,
									status:o
								});
								
								
							}
						}	
					}
				);
		},
		getstoremore: function(t) {
			console.log(t);
			var e = this,
				i = t.currentTarget.dataset.id,
				s = e.diypages;
			o.each(s.items, function(t, n) {
				if (t == i)
					if (null == n.status || '' == n.status) {
						if (-1 != n.data[0].linkurl.indexOf('stores')) var o = 'stores';
						else o = 'goods';
						var r = n.data[0].linkurl,
							d = n.data[0].data.length;
						a.get(
							'diypage/getInfo',
							{
								dataurl: r,
								num: d,
								paramsType: o
							},
							function(t) {
								(n.data[0].data = t.goods.list),
									n.data[0].data.length == t.goods.count && (n.data[0].showmore = !0),
									e.setData({
										diypages: s
									});
							}
						);
					} else {
						if (-1 != n.data[n.status].linkurl.indexOf('stores')) o = 'stores';
						else o = 'goods';
						(r = n.data[n.status].linkurl), (d = n.data[n.status].data.length);
						a.get(
							'diypage/getInfo',
							{
								dataurl: r,
								num: d,
								paramsType: o
							},
							function(t) {
								(n.data[n.status].data = t.goods.list),
									n.data[n.status].data.length == t.goods.count && (n.data[n.status].showmore = !0),
									e.setData({
										diypages: s
									});
							}
						);
					}
			});
		},
		close: function() {
			(t.globalData.flag = !0),
				uni.reLaunch({
					url: '../index/index'
				});
		},
		initSeckill: function(a) {
			var e = this,
				i = parseInt(a.status),
				s = a.starttime,
				n = a.endtime;

			if (-1 != i) {
				var o = 0,
					r = 0,
					d = t.globalData.approot;
				uni.request({
					url: d + 'timer.php',
					success: function(t) {
						var d = t.data;
						(o = 0 == i ? n - d : s - d),
							e.setData({
								lasttime: o
							}),
							clearInterval(e.timer),
							e.setTimer(a),
							(r = e.setTimerInterval(a)),
							e.setData({
								timer: r
							});
					}
				});
			}
		},
		setTimer: function(a) {
			var e = this,
				i = 0;

			if (-1 != a.status && parseInt(e.lasttime) % 10 == 0) {
				var s = t.globalData.approot;
				uni.request({
					url: s + 'timer.php',
					success: function(t) {
						var s = t.data;
						(i = 0 == a.status ? a.endtime - s : a.starttime - s),
							e.setData({
								lasttime: i
							});
					}
				});
			}

			i = parseInt(e.lasttime) - 1;
			var n = e.formatSeconds(i);
			e.setData({
				lasttime: i,
				hour: n.hour,
				min: n.min,
				sec: n.sec
			})
			//i <= 0 && e.onLoad();
		},
		setTimerInterval: function(t) {
			var a = this;
			var c=t;
			return setInterval(function() {
				a.setTimer(t);
			}, 1e4);
		},
		formatSeconds: function(t) {
			var a = parseInt(t),
				e = 0,
				i = 0;
			return (
				a > 60 && ((e = parseInt(a / 60)), (a = parseInt(a % 60)), e > 60 && ((i = parseInt(e / 60)), (e = parseInt(e % 60)))),
				{
					hour: i < 10 ? '0' + i : i,
					min: e < 10 ? '0' + e : e,
					sec: a < 10 ? '0' + a : a
				}
			);
		},
		cutGoods: function(t) {
			var a = t.currentTarget.dataset.type,
				e = t.currentTarget.dataset.num,
				i = t.currentTarget.dataset.id,
				s = this.diypages;

			for (var n in s.items)
				if (n == i) {
					var o = s.items[n].current || 0;
					'advance' == a
						? o < e - 1
							? ((s.items[n].current = o + 1),
							  this.setData({
									diypages: s
							  }))
							: ((s.items[n].current = 0),
							  this.setData({
									diypages: s
							  }))
						: o > 0
						? ((s.items[n].current = o - 1),
						  this.setData({
								diypages: s
						  }))
						: ((s.items[n].current = e - 1),
						  this.setData({
								diypages: s
						  }));
				}
		}
	}
};
</script>
<style>
@import './index.css';
</style>